package cn.dkdoo.utils.controller;

import cn.dkdoo.utils.config.DkdTransactionConfig;
import cn.dkdoo.utils.entity.RollbackRequest;
import cn.dkdoo.utils.entity.RollbackResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Nicky.Tang on 2021/5/12 11:26 下午
 *
 * @since 02.12.10
 */
@RestController
@RequestMapping("/comRollback")
public class ComRollbackController {
    @Autowired
    DkdTransactionConfig dkdTransactionConfig;

    @RequestMapping(name = "", method = RequestMethod.PUT)
    public RollbackResponse comRollback(@RequestBody RollbackRequest addRequest) {
        RollbackResponse response = new RollbackResponse();
        dkdTransactionConfig.rollback(addRequest.buildTraNo());
        response.buildSuccess();
        return response;
    }
}
